﻿using UnityEngine;
using System.Collections;

public class CameraManager : Singleton<CameraManager> 
{
	protected CameraManager () {}
	
	public Transform m_ObjectFocus;	
	public Vector3 m_Offset;
	
	private Transform m_LightsGroup;
	private Vector3 m_InitialLightsPosition;
	
	void Start () 
	{
		m_LightsGroup = transform.GetChildByName("Lights");
		m_InitialLightsPosition = m_LightsGroup.position;
	}
	
	void Update () 
	{
		Vector3 newPos = m_ObjectFocus.position;
		
		Vector3 lightPos = transform.position - m_Offset + m_InitialLightsPosition;
		lightPos.z = m_InitialLightsPosition.z;
		m_LightsGroup.position = lightPos;
		transform.position = newPos + m_Offset;
	}
}
